package stream;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class BufferReader {
	public static void main(String[] args) throws IOException{
		 BufferedReader br=new BufferedReader(new FileReader(new File("demo01.txt")));
		 String str;
		 while((str=br.readLine())!=null){
			 System.out.println(str);
		 }
		 //追加
		 BufferedWriter bw=new BufferedWriter(new FileWriter("demo02.txt",true));
		 bw.write("我擦aaa");
		 bw.newLine();
		 bw.write("bbbbb");
		 bw.flush();
		 br.close();
		 bw.close();
	}
}
